package com.demo.function.orika;

import com.alibaba.fastjson.JSON;
import com.demo.function.orika.entity.OrikaDestination;
import com.demo.function.orika.entity.OrikaSource;
import lombok.extern.slf4j.Slf4j;
import ma.glasnost.orika.MapperFacade;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Slf4j
@Service
public class OrikaService {

    @Resource
    private MapperFacade mapperFacade;

    public OrikaDestination map(OrikaSource orikaSource) {
        OrikaDestination orikaDestination = mapperFacade.map(orikaSource, OrikaDestination.class);
        log.info("orikaDestination:{}", JSON.toJSONString(orikaDestination));
        return orikaDestination;
    }
}
